#ifndef THREAD_H_
#define THREAD_H_
#include "defs.h"

class ThreadPool;
class Job;
#define EXIT_SIGN ((Job *)-1)
#define STOP_SIGN ((Job *)-2)
#define CONTINUE_SIGN ((Job *)-3)

typedef void* (*THREAD_ROUTINE)(void *);
class Thread {
private:
	pthread_t _thread;

protected:
	ThreadPool* _pool;
	std::string _name;

public:
	Thread(ThreadPool* pool);
	virtual ~Thread();
	bool start(THREAD_ROUTINE routine = NULL);
	void yield();
	void stop();
	void set_name(std::string name);
	void set_name(const char* name);
	std::string get_name();
};
#endif
